#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;

const ll maxn{105};
ll n,m;
ll a[maxn][maxn];

int main(){
    iostream::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>n>>m;
    const auto ra = [&](){
        ll t;
        for(ll i{1};i<=n;i++){
            for(ll j{1};j<=m;j++){
                cin>>t;
                a[i][j]+=t;
            }
        }
    };
    ra();
    ra();
    for(ll i{1};i<=n;i++){
        for(ll j{1};j<=m;j++){
            cout<<a[i][j]<<' ';
        }
        cout<<'\n';
    }
}   